package com.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;


/**
 * The persistent class for the TEXTTYPE database table.
 * 
 */
@Entity
@NamedQuery(name="Texttype.findAll", query="SELECT t FROM Texttype t")
public class Texttype implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private Long textno;

	@Column(name="\"VALUE\"")
	private String value;
	
	@OneToMany(mappedBy = "texttype",fetch=FetchType.EAGER)
	@JSONField(serialize=false)
	private List<Word> words;
	

	public Texttype() {
	}

	public long getTextno() {
		return this.textno;
	}

	public void setTextno(long textno) {
		this.textno = textno;
	}

	public String getValue() {
		return this.value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public List<Word> getWords() {
		return words;
	}

	public void setWords(List<Word> words) {
		this.words = words;
	}
	
	public Word addWord(Word word) {
		getWords().add(word);
		word.setTexttype(this);
		
		return word;
	}
	
	public Word removeWord(Word word) {
		getWords().remove(word);
		word.setTexttype(null);
		
		return word;
	}
}